package com.you.atlas.web.place.module.screen;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.you.atlas.biz.place.service.NoteQueryService;
import com.you.atlas.biz.place.service.PlaceQueryService;
import com.you.common.ibatis.data.DataList;
import com.you.place.dal.dao.dataobject.PlaceDO;

public class NoteList {

    @Autowired
    private NoteQueryService  noteQueryService;

    @Autowired
    private PlaceQueryService placeQueryService;

    public void execute(@Param("pageNo") int pageNo, @Param("id") Long placeId, Context context, Navigator navigator) {
        PlaceDO placeDO = placeQueryService.find(placeId);
        if (placeDO == null) {
            navigator.redirectTo("placeModule").withTarget("error.vm");
            return;
        }
        DataList dataList = noteQueryService.queryNoteByPlaceId(pageNo, placeId);
        context.put("dataList", dataList);
        context.put("placeDO", placeDO);
    }
}
